package com.shixi.shixitraining.shixitraining.base;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;

import com.shixi.shixitraining.shixitraining.R;
import com.shixi.shixitraining.shixitraining.ui.MainActivity;

public class SplashActivity extends AppCompatActivity {
    private  final  int DELAY_TIME=2000;
    private final int MESSAGE_LAUGH=1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        handler.sendEmptyMessageDelayed(MESSAGE_LAUGH,DELAY_TIME);
    }

  private  Handler handler=new Handler(){
      @Override
      public void handleMessage(Message msg) {
          super.handleMessage(msg);
          if (msg.what==MESSAGE_LAUGH){
              startActivity(new Intent(SplashActivity.this, MainActivity.class));
          }
          finish();
      }
  };


}
